[One Workflow][Bug] "Enabled" toggle remains active when workflow YAML has validation errors#252698
Conversation
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
|
| highlightedStepId: undefined, | ||
| isTestModalOpen: false, | ||
| loading: initialLoadingState, | ||
| hasValidationErrors: false, |
There was a problem hiding this comment.
This flag is managed downstream by the schema validation of the Monaco YAML editor. Which is fine, but could we be a bit more explicit with the name?
| hasValidationErrors: false, | |
| hasYamlSchemaValidationErrors: false, |
…remains_active_when_validation_errors
|
Starting backport for target branches: 9.3 https://github.com/elastic/kibana/actions/runs/22179623851 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…L has validation errors (elastic#252698) ## Summary Fixes a bug where the "Enabled" toggle and "Run" button in the workflow detail header remained active even when the workflow YAML had validation errors. ### Problem The toggle's disabled state was driven only by `selectIsYamlSyntaxValid`, which uses a **lenient** parser (`WorkflowSchemaForAutocomplete`). Strict validation errors — schema violations, duplicate step names, invalid liquid templates, missing connector IDs — were produced by Monaco inside `WorkflowYAMLEditor` but lived as **local React state**, inaccessible to the sibling `WorkflowDetailHeader` component. Additionally, on page refresh, Monaco hasn't mounted yet so there was no validation signal at all — even workflows the server already flagged as invalid appeared toggleable. ## Before: https://github.com/user-attachments/assets/9054859c-49cc-4918-9bbc-1aa5bfafd47c ## After <img width="1913" height="843" alt="Screenshot 2026-02-11 at 13 52 55" src="https://github.com/user-attachments/assets/52f34996-3682-416b-8905-54ada8c23afd" /> ### Solution - Added `hasValidationErrors: boolean` to the Redux `WorkflowDetailState` - `WorkflowYAMLEditor` now syncs error-severity validation results to Redux via `setHasValidationErrors` - `WorkflowDetailHeader` computes a combined validity check: ``` const isValid = isSyntaxValid && !hasValidationErrors && workflow?.valid !== false; ``` This covers three layers: 1. **`isSyntaxValid`** — lenient YAML parse (catches broken syntax immediately) 2. **`hasValidationErrors`** — strict Monaco validation (catches schema errors after editor mounts) 3. **`workflow?.valid !== false`** — server-side validation (covers initial page load before Monaco mounts) ### Changes | File | Change | |------|--------| | `types.ts` | Added `hasValidationErrors` field to `WorkflowDetailState` | | `slice.ts` | Added `setHasValidationErrors` reducer and initial value | | `selectors.ts` | Added `selectHasValidationErrors` selector | | `workflow_yaml_editor.tsx` | Syncs validation errors to Redux via `useEffect` | | `workflow_detail_header.tsx` | Uses combined `isValid` for toggle, run button, and tooltips | | `workflow_detail_header.test.tsx` | Unskipped broken test, added tests for validation errors and server-side `valid` flag |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
…254263) ## Summary Rolls back the `Run` button changes in this PR #252698. Maintaining the changes in the `Enabled` switch. ### Screenshot <img width="1917" height="987" alt="Captura de pantalla 2026-02-20 a les 17 46 42" src="https://github.com/user-attachments/assets/542bc02a-2379-4b48-973c-10cf1e296bea" />
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
2 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
29 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
Fixes a bug where the "Enabled" toggle and "Run" button in the workflow detail header remained active even when the workflow YAML had validation errors.
Problem
The toggle's disabled state was driven only by
selectIsYamlSyntaxValid, which uses a lenient parser (WorkflowSchemaForAutocomplete). Strict validation errors — schema violations, duplicate step names, invalid liquid templates, missing connector IDs — were produced by Monaco insideWorkflowYAMLEditorbut lived as local React state, inaccessible to the siblingWorkflowDetailHeadercomponent.Additionally, on page refresh, Monaco hasn't mounted yet so there was no validation signal at all — even workflows the server already flagged as invalid appeared toggleable.
Before:
Screen.Recording.2026-02-11.at.12.24.09.mov
After
Solution
hasValidationErrors: booleanto the ReduxWorkflowDetailStateWorkflowYAMLEditornow syncs error-severity validation results to Redux viasetHasValidationErrorsWorkflowDetailHeadercomputes a combined validity check:This covers three layers:
isSyntaxValid— lenient YAML parse (catches broken syntax immediately)hasValidationErrors— strict Monaco validation (catches schema errors after editor mounts)workflow?.valid !== false— server-side validation (covers initial page load before Monaco mounts)Changes
types.tshasValidationErrorsfield toWorkflowDetailStateslice.tssetHasValidationErrorsreducer and initial valueselectors.tsselectHasValidationErrorsselectorworkflow_yaml_editor.tsxuseEffectworkflow_detail_header.tsxisValidfor toggle, run button, and tooltipsworkflow_detail_header.test.tsxvalidflag